<?php
// 20090211
// verification code changed
// GetLangString updated

$name 	= escapestr($_REQUEST['name']);
$query  = "SELECT `signup` from `users` where `status`='0' and `name`='$name'"; 
$result = mysql_query($query);
if (mysql_num_rows($result)){ 
	$signup = mysql_result($result,0);
	$server_code  =  md5($signup.$name);
	$remote_code =   $_REQUEST['code'];
	if ( $server_code == $remote_code ) {
		$query        = "UPDATE users set status=1 where name='$name'" ;
		$result = mysql_query($query);
		if ($result) {
		$SITE_MIDDLE .=FormatElement(str_ireplace("%site_name%",$SITE_NAME,GetLangString($lang,"txt_welcome")),GetLangString($lang,"msg_verifyok")); 
		} else {
			$SITE_MIDDLE .= FormatElement(GetLangString($lang,"txt_error"),GetLangString($lang,"msg_dberror"));
		}
	} else {
	$SITE_MIDDLE .= FormatElement(GetLangString($lang,"txt_error"),GetLangString($lang,"msg_verifyfail"));
	}
} else {
	$SITE_MIDDLE .= FormatElement(GetLangString($lang,"txt_error"),GetLangString($lang,"msg_verifyerr"));
}

?>
